<?php 
	if(count($this->messageError)>0){
		$errors = $this->formErrors($this->messageError,array('id'=>'errors'));
		
	}
	$type = $this->type;
	$id   = $this->id;
	
	$title               = $this->formText($type . 'title', $this->data['title'], array('class'=>'txtlong', 'id' => $type . 'title'));
	
	$linkBtn             = $this->baseUrl($this->currentController . '/editor/type/' . $type . '/task/delete/id/' . $id);
	$btnDelete           = $this->formButton($type . '_delete','Delete',array('onclick'=>"submitEditor('" . $linkBtn . "', '" . $type . "')"));
	$linkBtn             = $this->baseUrl($this->currentController . '/editor/type/' . $type . '/task/go/id/' . $id);
	$btnGo               = $this->formButton($type . '_Go','Go',array('onclick'=>"submitEditor('" . $linkBtn . "', '" . $type . "')"));
	$linkBtn             = $this->baseUrl($this->currentController . '/editor/type/' . $type . '/task/back/id/' . $id);
	$btnPreview          = $this->formButton($type . '_preview ','Preview',array('onclick'=>"submitEditor('" . $linkBtn . "', '" . $type . "')"));
	
	if($type == 'timetable') {
		$header = 'Time Table';
	}else {
		$header = 'Notice';
	}
	
	$strBtn              = $btnDelete . ' ' . $btnPreview . ' ' . $btnGo; 
	
	$icon       		 = '<a href = "#" onclick = "changeDisplay(\'timetable\')">
								<img src = "' . $this->imgUrl . '/icon/arrow_down.png" id = "timetableImg">
								' . $header . '
							</a>';
?>
<script type="text/javascript">
    function changeDisplay(id){
       var imgLink = $('#' + id + 'Img').attr('src');
       if(imgLink == '/sunny/public/templates/admin/main/images/icon/arrow_up.png') {
    	   imgLink = '/sunny/public/templates/admin/main/images/icon/arrow_down.png';
       }else {
    	   imgLink = '/sunny/public/templates/admin/main/images/icon/arrow_up.png';
       }
       $('div#' + id + 'info').slideToggle();
       $('#' + id + 'Img').attr("src",imgLink);
    } 
</script>

 <div class="adminheader"><?php echo $icon; ?></div>
 			<div id = "<?php echo $type;?>info" style="display: block">
                                <div id="row">
                                    <?php echo $errors; ?>
                                    <div class="label">title:</div>
                                    <?php echo $title;?>			
                                </div>
                                
                                 <div id="row">
                                    <?php $this->myEditor($type, $this->data['content'], array('toolbar' => 'MyToolbar'),  $width = '100%', $height = '250');?>			
                                </div>
                                
                                 <div id="row">
                                  <div id = <?php echo $type; ?>>
                                   <?php echo $strBtn;?>
                                  </div>			
                                </div>
                               
                                <div class="clr"></div>
            </div>
            